/**
 * 
 */
package com.pocketsweet.ui.uilib;

import android.content.Context;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

import com.pocketsweet.R;
import com.pocketsweet.ui.Main;

/**
 * @author bobhu 自定义toast 弹出位置屏幕正中央 弹出样式
 */
public class ToastEx {
	public static Toast toast;

	public static void createToast(Context context, String msg) {
		// LayoutInflater inflater = LayoutInflater.from(context);
		// View v = inflater.inflate(R.layout.view_toast_ex, null);// 得到加载view
		// TextView tipTextView = (TextView) v.findViewById(R.id.exToastText);//
		// 提示文字
		// tipTextView.setText(msg);// 设置加载信息
		Toast toast = Toast.makeText(context, msg, Toast.LENGTH_LONG);
		// toast = new Toast(context);
		toast.setGravity(Gravity.CENTER, 0, 0);
		// toast.setView(v);
		toast.setDuration(Toast.LENGTH_SHORT);
		toast.show();
	}

	public static void createToast(Context context, int stringId) {
		LayoutInflater inflater = LayoutInflater.from(context);
		View v = inflater.inflate(R.layout.view_toast_ex, null);// 得到加载view
		TextView tipTextView = (TextView) v.findViewById(R.id.exToastText);// 提示文字
		tipTextView.setText(context.getText(stringId));// 设置加载信息
		toast = new Toast(context);
		toast.setGravity(Gravity.CENTER, 0, 0);
		toast.setView(v);
		toast.setDuration(Toast.LENGTH_LONG);
		toast.show();
	}

}
